import {Component, OnInit} from '@angular/core';
import {NavController, ToastController} from '@ionic/angular';
import {BasePage} from '../../common/basePage';
import {AppVersion} from '@ionic-native/app-version/ngx';
import {HttpService} from '../../services/http.service';

/**
 * 关于我们
 */
@Component({
  selector: 'app-about-us',
  templateUrl: './about-us.page.html',
  styleUrls: ['./about-us.page.scss'],
})
export class AboutUsPage extends BasePage implements OnInit {

  // 当前APP版本号
  versionNumber = '';

  constructor(public navCtrl: NavController,
              public toastCtrl: ToastController,
              private appVersion: AppVersion,
              private service$: HttpService
  ) {
    super(navCtrl, toastCtrl);
  }

  ngOnInit() {
    this.getAppVersion();
  }

  async getAppVersion() {
    this.versionNumber = await this.appVersion.getVersionNumber();
  }

  async doUpgrade() {
    // 版本检测
    await this.service$.detectionUpgrade(true);
  }

}
